﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Service;
using Model;
using System.Data;
namespace Manager
{
    public class ServerUploadLogManager
    {
        ServerUploadLogService service = new ServerUploadLogService();
        public int Add(ServerUploadLog log)
        {
             return service.Add(log);
        }
        public System.Data.DataTable GetLog(int pageIndex, int pageSize, out int count)
        {
            return Translate(service.GetLog(pageIndex, pageSize, out count));
        }
        public DataTable GetLog(int pageIndex, int pageSize, out int count, string filedname, string filedvalue)
        {
            return Translate(service.GetLog(pageIndex, pageSize, out count, filedname, filedvalue));
        }
        public DataTable GetLogBy(string filedname, string filedvalue)
        {
            return Translate(service.GetLogBy(filedname, filedvalue));
        }
        public DataTable Translate(DataTable dt)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["State"].ToString() == "X")
                    dt.Rows[i]["State"] = "待处理";
                if (dt.Rows[i]["State"].ToString() == "F")
                    dt.Rows[i]["State"] = "处理失败";
                if (dt.Rows[i]["State"].ToString() == "T")
                    dt.Rows[i]["State"] = "已经处理";
            }
            return dt;
        }
    }
}
